﻿namespace ExamV5
{
    //using FTROCKEY2CONTROLLib;
    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Management;
    using System.Text.RegularExpressions;
    using System.Web.Security;
    using System.Web.UI.WebControls;

    public class PublicFun
    {
        public void AddStudyInfo(string strUserCode)
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("select ID,PlanName,LastWork,StudyUserCode,StudyUserName from StudyPlanInfo where LastWork<>''", connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                string values = this.GetValues("select Worker from UserInfo where UserCode='" + strUserCode + "'", "Worker");
                if (!((reader["LastWork"].ToString().IndexOf("," + values + ",") == -1) ? (reader["LastWork"].ToString().IndexOf(",所有职务,") == -1) : false) && (this.GetValues("select PlanID from StudyUser where UserCode='" + strUserCode + "' and PlanID=" + reader["ID"].ToString(), "PlanID") == ""))
                {
                    string str2 = this.GetValues("select UserName from UserInfo where UserCode='" + strUserCode + "'", "UserName");
                    string str3 = reader["StudyUserCode"] + strUserCode + ",";
                    string str4 = string.Concat(new object[] { reader["StudyUserName"], "[", strUserCode, "]", str2, "," });
                    string strSql = "insert into StudyUser(UserCode,PlanID,PlanName,CountTime,LoginIP) values('" + strUserCode + "'," + reader["ID"].ToString() + ",'" + reader["PlanName"].ToString() + "',0,'')";
                    strSql = strSql + ";update StudyPlanInfo set StudyUserCode='" + str3 + "',StudyUserName='" + str4 + "'  where ID=" + reader["ID"].ToString();
                    this.ExecuteSql(strSql);
                }
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        public void AddUserPaper(string strUserCode)
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("select ID,PaperStatus,LastWorkName from PaperInfo where LastJoin='Y'", connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                string str2;
                if (!(reader["LastWorkName"].ToString().Replace("##", "").Trim() == ""))
                {
                    string values = this.GetValues("select Worker from UserInfo where UserCode='" + strUserCode + "'", "Worker");
                    if ((reader["LastWorkName"].ToString().IndexOf("#" + values + "#") != -1) && (this.GetValues("select PaperID from ExamUser where Flag='A' and UserCode='" + strUserCode + "' and PaperID=" + reader["ID"].ToString(), "PaperID") == ""))
                    {
                        str2 = "";
                        str2 = ("Insert into ExamUser(UserCode,PaperID,ExamName,Subject,GetCountFen,ExamType,Flag,LastTime) select '" + strUserCode + "'," + reader["ID"].ToString() + ",ExamName,SubjectName,'0','" + reader["PaperStatus"].ToString() + "','A',ExamTime from PaperInfo where ID=" + reader["ID"].ToString()) + ";Insert into PaperData(PaperID,UserCode,RubricS,RubricD,RubricB,RubricF,RubricA,RubricC,RubricT,RubricAN,RubricO,RubricJ,SortInfo) ";
                        str2 = str2 + " select PaperID,'" + strUserCode + "' as UserCode,RubricS,RubricD,RubricB,RubricF,RubricA,RubricC,RubricT,RubricAN,RubricO,RubricJ,'ID#ID#ID#ID#ID#ID#ID#ID#ID#ID' as SortInfo from PaperDataTmp where PaperID=" + reader["ID"].ToString();
                        this.ExecuteSql(str2);
                    }
                }
                else if (this.GetValues("select PaperID from ExamUser where Flag='A' and UserCode='" + strUserCode + "' and PaperID=" + reader["ID"].ToString(), "PaperID") == "")
                {
                    str2 = "";
                    str2 = ("Insert into ExamUser(UserCode,PaperID,ExamName,Subject,GetCountFen,ExamType,Flag,LastTime) select '" + strUserCode + "'," + reader["ID"].ToString() + ",ExamName,SubjectName,'0','" + reader["PaperStatus"].ToString() + "','A',ExamTime from PaperInfo where ID=" + reader["ID"].ToString()) + ";Insert into PaperData(PaperID,UserCode,RubricS,RubricD,RubricB,RubricF,RubricA,RubricC,RubricT,RubricAN,RubricO,RubricJ,SortInfo) ";
                    str2 = str2 + " select PaperID,'" + strUserCode + "' as UserCode,RubricS,RubricD,RubricB,RubricF,RubricA,RubricC,RubricT,RubricAN,RubricO,RubricJ,'ID#ID#ID#ID#ID#ID#ID#ID#ID#ID' as SortInfo from PaperDataTmp where PaperID=" + reader["ID"].ToString();
                    this.ExecuteSql(str2);
                }
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
            this.AddStudyInfo(strUserCode);
        }

        public void AddUserWorkPaper(string strUserCode)
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("select ID from WorkPaperInfo where LastJoin='Y'", connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                if (this.GetValues("select PaperID from WorkExamUser where UserCode='" + strUserCode + "' and PaperID=" + reader["ID"].ToString(), "PaperID") == "")
                {
                    string strSql = "";
                    strSql = ("Insert into WorkExamUser(UserCode,PaperID,ExamName,SubjectName,GetCountFen,Flag,LoginIP,LastDate) select '" + strUserCode + "'," + reader["ID"].ToString() + ",ExamName,SubjectName,'0','A','','' from WorkPaperInfo where ID=" + reader["ID"].ToString()) + ";Insert into WorkPaperData(PaperID,UserCode,RubricS,SortInfo) ";
                    strSql = strSql + " select PaperID,'" + strUserCode + "' as UserCode,RubricS,SortInfo from WorkPaperData where UserCode='' and PaperID=" + reader["ID"].ToString();
                    this.ExecuteSql(strSql);
                }
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        public bool CheckIP(string UserIP, string StartIP, string EndIP)
        {
            if (UserIP == "::1") UserIP = "127.0.0.1";
            bool flag = false;
            string[] strArray = UserIP.Split(new char[] { '.' });
            string[] strArray2 = StartIP.Split(new char[] { '.' });
            string[] strArray3 = EndIP.Split(new char[] { '.' });
            if ((Convert.ToInt16(strArray[0]) > Convert.ToInt16(strArray2[0])) ? (Convert.ToInt16(strArray[0]) > Convert.ToInt16(strArray3[0])) : true)
            {
                if ((Convert.ToInt16(strArray[0]) == Convert.ToInt16(strArray2[0])) ? (Convert.ToInt16(strArray[0]) > Convert.ToInt16(strArray3[0])) : true)
                {
                    return false;
                }
                if ((Convert.ToInt16(strArray[1]) <= Convert.ToInt16(strArray2[1])) || (Convert.ToInt16(strArray[1]) > Convert.ToInt16(strArray3[1])))
                {
                    if ((Convert.ToInt16(strArray[1]) == Convert.ToInt16(strArray2[1])) ? (Convert.ToInt16(strArray[1]) > Convert.ToInt16(strArray3[1])) : true)
                    {
                        return flag;
                    }
                    if ((Convert.ToInt16(strArray[2]) <= Convert.ToInt16(strArray2[2])) || (Convert.ToInt16(strArray[2]) > Convert.ToInt16(strArray3[2])))
                    {
                        if ((Convert.ToInt16(strArray[2]) == Convert.ToInt16(strArray2[2])) ? (Convert.ToInt16(strArray[2]) > Convert.ToInt16(strArray3[2])) : true)
                        {
                            return false;
                        }
                        if ((Convert.ToInt16(strArray[3]) >= Convert.ToInt16(strArray2[3])) ? (Convert.ToInt16(strArray[3]) > Convert.ToInt16(strArray3[3])) : true)
                        {
                            return false;
                        }
                        return true;
                    }
                }
                return true;
            }
            return true;
        }

        public string CheckReg()
        {
            //string password = "";
            //string connectionString = "";
            //connectionString = ConfigurationManager.ConnectionStrings["RegInfo"].ConnectionString;
            //ManagementClass class2 = new ManagementClass("Win32_NetworkAdapterConfiguration");
            //foreach (ManagementObject obj2 in class2.GetInstances())
            //{
            //    if ((bool) obj2["IPEnabled"])
            //    {
            //        string[] strArray = obj2["MacAddress"].ToString().Split(new char[] { ':' });
            //        for (int i = 0; i < strArray.Length; i++)
            //        {
            //            password = password + strArray[i].ToString();
            //        }
            //        password = password.Replace("A", "０");
            //        password = password.Replace("B", "１");
            //        password = password.Replace("C", "２");
            //        password = password.Replace("D", "３");
            //        password = password.Replace("E", "４");
            //        password = password.Replace("F", "５");
            //    }
            //}
            //if (!(connectionString != FormsAuthentication.HashPasswordForStoringInConfigFile(FormsAuthentication.HashPasswordForStoringInConfigFile(password, "SHA1"), "MD5")))
            //{
            return "Yes";
            //}
            //return "No";
        }

        public string CheckString(string str)
        {
            str = str.Trim();
            str = str.Replace("xp_cmdshell", "");
            str = str.Replace("%", "");
            str = str.Replace("&", "");
            str = str.Replace(";", "");
            str = str.Replace("$", "");
            str = str.Replace("%", "");
            str = str.Replace("$", "");
            str = str.Replace("@", "");
            str = str.Replace(@"\", "");
            str = str.Replace("<>", "");
            str = str.Replace("+", "");
            str = str.Replace("=", "");
            str = str.Replace("CR", "");
            str = str.Replace("LF", "");
            str = str.Replace("'", "‘");
            str = str.Replace("or", "ＯＲ");
            str = str.Replace("oR", "ＯＲ");
            str = str.Replace("Or", "ＯＲ");
            str = str.Replace("select", "ＳＥＬＥＣＴ");
            str = str.Replace("delete", "ＤＥＬＥＴＥ");
            str = str.Replace("truncate", "ＴＲＵＮＣＡＴＥ");
            str = str.Replace("exec", "ＥＸＥＣ");
            str = str.Replace("insert", "ＩＮＳＥＲＴ");
            str = str.Replace("master", "ＭＡＳＴＥＲ");
            str = str.Replace("declare", "ＤＥＣＬＡＲＥ");
            str = str.Replace("count", "ＣＯＵＮＴ");
            str = str.Replace("and", "ＡＮＤ");
            str = str.Replace("update", "ＵＰＤＡＴＥ");
            str = str.Replace("where", "ＷＨＥＲＥ");
            str = str.Replace("sp_", "ＳＰ＿");
            str = str.Replace("xp_", "ＸＰ＿");
            str = str.Replace("Sp_", "ＳＰ＿");
            str = str.Replace("Xp_", "ＸＰ＿");
            str = str.Replace("sP_", "ＳＰ＿");
            str = str.Replace("xP_", "ＸＰ＿");
            str = str.Replace("execute", "ＥＸＥＣＵＴＥ");
            str = str.Replace("OR", "ＯＲ");
            str = str.Replace("SELECT", "ＳＥＬＥＣＴ");
            str = str.Replace("DELETE", "ＤＥＬＥＴＥ");
            str = str.Replace("TRUNCATE", "ＴＲＵＮＣＡＴＥ");
            str = str.Replace("EXEC", "ＥＸＥＣ");
            str = str.Replace("INSERT", "ＩＮＳＥＲＴ");
            str = str.Replace("MASTER", "ＭＡＳＴＥＲ");
            str = str.Replace("DECLARE", "ＤＥＣＬＡＲＥ");
            str = str.Replace("COUNT", "ＣＯＵＮＴ");
            str = str.Replace("AND", "ＡＮＤ");
            str = str.Replace("UPDATE", "ＵＰＤＡＴＥ");
            str = str.Replace("WHERE", "ＷＨＥＲＥ");
            str = str.Replace("SP_", "ＳＰ＿");
            str = str.Replace("XP_", "ＸＰ＿");
            str = str.Replace("EXECUTE", "ＥＸＥＣＵＴＥ");
            str = str.Replace("+", "＋");
            str = str.Replace("(", "（");
            str = str.Replace(")", "）");
            str = str.Replace(";", "；");
            str = str.Replace("''", "“”");
            str = str.Replace("0x", "ＯＸ");
            return str;
        }

        public bool CheckTime(string NowTime, string StartTime, string EndTime)
        {
            DateTime time2 = Convert.ToDateTime(DateTime.Now.ToString());
            DateTime time3 = Convert.ToDateTime(StartTime);
            DateTime time4 = Convert.ToDateTime(EndTime);
            if (!((time2 >= time3) ? (time2 > time4) : true))
            {
                return false;
            }
            return true;
        }

        public string ConvertGBBig(string strInfo)
        {
            string str = "";
            string str2 = "";
            string str3 = "";
            string str4 = "";
            int startIndex = -1;
            str = "万与丑专业丛东丝丢两严丧个丬丰临为丽举么义乌乐乔习乡书买乱争于亏云亘亚产亩亲亵亸亿仅从仑仓仪们价众优伙会伛伞";
            str = (((((((((((((((((((((((str + "伟传伤伥伦伧伪伫体余佣佥侠侣侥侦侧侨侩侪侬俣俦俨俩俪俭债倾偬偻偾偿傥傧储傩儿兑兖党兰关兴兹养兽冁内冈册写军农") + "冢冯冲决况冻净凄凉凌减凑凛几凤凫凭凯击凼凿刍划刘则刚创删别刬刭刽刿剀剂剐剑剥剧劝办务劢动励劲劳势勋勐勚匀匦匮" + "区医华协单卖卢卤卧卫却卺厂厅历厉压厌厍厕厢厣厦厨厩厮县参叆叇双发变叙叠叶号叹叽吁后吓吕吗吣吨听启吴呒呓呕呖呗") + "员呙呛呜咏咔咙咛咝咤咴咸哌响哑哒哓哔哕哗哙哜哝哟唛唝唠唡唢唣唤唿啧啬啭啮啰啴啸喷喽喾嗫呵嗳嘘嘤嘱噜噼嚣嚯团园" + "囱围囵国图圆圣圹场坂坏块坚坛坜坝坞坟坠垄垅垆垒垦垧垩垫垭垯垱垲垴埘埙埚埝埯堑堕塆墙壮声壳壶壸处备复够头夸夹夺") + "奁奂奋奖奥妆妇妈妩妪妫姗姜娄娅娆娇娈娱娲娴婳婴婵婶媪嫒嫔嫱嬷孙学孪宁宝实宠审宪宫宽宾寝对寻导寿将尔尘尧尴尸尽" + "层屃屉届属屡屦屿岁岂岖岗岘岙岚岛岭岳岽岿峃峄峡峣峤峥峦崂崃崄崭嵘嵚嵛嵝嵴巅巩巯币帅师帏帐帘帜带帧帮帱帻帼幂幞") + "干并广庄庆庐庑库应庙庞废庼廪开异弃张弥弪弯弹强归当录彟彦彻径徕御忆忏忧忾怀态怂怃怄怅怆怜总怼怿恋恳恶恸恹恺恻" + "恼恽悦悫悬悭悯惊惧惨惩惫惬惭惮惯愍愠愤愦愿慑慭憷懑懒懔戆戋戏戗战戬户扎扑扦执扩扪扫扬扰抚抛抟抠抡抢护报担拟拢") + "拣拥拦拧拨择挂挚挛挜挝挞挟挠挡挢挣挤挥挦捞损捡换捣据捻掳掴掷掸掺掼揸揽揿搀搁搂搅携摄摅摆摇摈摊撄撑撵撷撸撺擞" + "攒敌敛数斋斓斗斩断无旧时旷旸昙昼昽显晋晒晓晔晕晖暂暧札术朴机杀杂权条来杨杩杰极构枞枢枣枥枧枨枪枫枭柜柠柽栀栅") + "标栈栉栊栋栌栎栏树栖样栾桊桠桡桢档桤桥桦桧桨桩梦梼梾检棂椁椟椠椤椭楼榄榇榈榉槚槛槟槠横樯樱橥橱橹橼檐檩欢欤欧" + "歼殁殇残殒殓殚殡殴毁毂毕毙毡毵氇气氢氩氲汇汉污汤汹沓沟没沣沤沥沦沧沨沩沪沵泞泪泶泷泸泺泻泼泽泾洁洒洼浃浅浆浇") + "浈浉浊测浍济浏浐浑浒浓浔浕涂涌涛涝涞涟涠涡涢涣涤润涧涨涩淀渊渌渍渎渐渑渔渖渗温浏湾湿溃溅溆溇滗滚滞滟滠满滢滤" + "滥滦滨滩滪漤潆潇潋潍潜潴澜濑濒灏灭灯灵灾灿炀炉炖炜炝点炼炽烁烂烃烛烟烦烧烨烩烫烬热焕焖焘煅煳熘爱爷牍牦牵牺犊") + "犟状犷犸犹狈狍狝狞独狭狮狯狰狱狲猃猎猕猡猪猫猬献獭玑玙玚玛玮环现玱玺珉珏珐珑珰珲琎琏琐琼瑶瑷璇璎瓒瓮瓯电画畅" + "畲畴疖疗疟疠疡疬疮疯疱疴痈痉痒痖痨痪痫痴瘅瘆瘗瘘瘪瘫瘾瘿癞癣癫癯皑皱皲盏盐监盖盗盘眍眦眬着睁睐睑瞒瞩矫矶矾矿") + "砀码砖砗砚砜砺砻砾础硁硅硕硖硗硙硚确硷碍碛碜碱碹磙礼祎祢祯祷祸禀禄禅离秃秆种积称秽秾稆税稣稳穑穷窃窍窑窜窝窥" + "窦窭竖竞笃笋笔笕笺笼笾筑筚筛筜筝筹签简箓箦箧箨箩箪箫篑篓篮篱簖籁籴类籼粜粝粤粪粮糁糇紧絷纟纠纡红纣纤纥约级纨") + "纩纪纫纬纭纮纯纰纱纲纳纴纵纶纷纸纹纺纻纼纽纾线绀绁绂练组绅细织终绉绊绋绌绍绎经绐绑绒结绔绕绖绗绘给绚绛络绝绞" + "统绠绡绢绣绤绥绦继绨绩绪绫绬续绮绯绰绱绲绳维绵绶绷绸绹绺绻综绽绾绿缀缁缂缃缄缅缆缇缈缉缊缋缌缍缎缏缐缑缒缓缔") + "缕编缗缘缙缚缛缜缝缞缟缠缡缢缣缤缥缦缧缨缩缪缫缬缭缮缯缰缱缲缳缴缵罂网罗罚罢罴羁羟羡翘翙翚耢耧耸耻聂聋职聍联" + "聩聪肃肠肤肷肾肿胀胁胆胜胧胨胪胫胶脉脍脏脐脑脓脔脚脱脶脸腊腌腘腭腻腼腽腾膑臜舆舣舰舱舻艰艳艹艺节芈芗芜芦苁苇") + "苈苋苌苍苎苏苘苹茎茏茑茔茕茧荆荐荙荚荛荜荞荟荠荡荣荤荥荦荧荨荩荪荫荬荭荮药莅莜莱莲莳莴莶获莸莹莺莼萚萝萤营萦" + "萧萨葱蒇蒉蒋蒌蓝蓟蓠蓣蓥蓦蔷蔹蔺蔼蕲蕴薮藁藓虏虑虚虫虬虮虽虾虿蚀蚁蚂蚕蚝蚬蛊蛎蛏蛮蛰蛱蛲蛳蛴蜕蜗蜡蝇蝈蝉蝎蝼") + "蝾螀螨蟏衅衔补衬衮袄袅袆袜袭袯装裆裈裢裣裤裥褛褴襁襕见观觃规觅视觇览觉觊觋觌觍觎觏觐觑觞触觯詟誉誊讠计订讣认" + "讥讦讧讨让讪讫训议讯记讱讲讳讴讵讶讷许讹论讻讼讽设访诀证诂诃评诅识诇诈诉诊诋诌词诎诏诐译诒诓诔试诖诗诘诙诚诛") + "诜话诞诟诠诡询诣诤该详诧诨诩诪诫诬语诮误诰诱诲诳说诵诶请诸诹诺读诼诽课诿谀谁谂调谄谅谆谇谈谊谋谌谍谎谏谐谑谒" + "谓谔谕谖谗谘谙谚谛谜谝谞谟谠谡谢谣谤谥谦谧谨谩谪谫谬谭谮谯谰谱谲谳谴谵谶谷豮贝贞负贠贡财责贤败账货质贩贪贫贬") + "购贮贯贰贱贲贳贴贵贶贷贸费贺贻贼贽贾贿赀赁赂赃资赅赆赇赈赉赊赋赌赍赎赏赐赑赒赓赔赕赖赗赘赙赚赛赜赝赞赟赠赡赢" + "赣赪赵赶趋趱趸跃跄跖跞践跶跷跸跹跻踊踌踪踬踯蹑蹒蹰蹿躏躜躯车轧轨轩轪轫转轭轮软轰轱轲轳轴轵轶轷轸轹轺轻轼载轾") + "轿辀辁辂较辄辅辆辇辈辉辊辋辌辍辎辏辐辑辒输辔辕辖辗辘辙辚辞辩辫边辽达迁过迈运还这进远违连迟迩迳迹适选逊递逦逻" + "遗遥邓邝邬邮邹邺邻郁郄郏郐郑郓郦郧郸酝酦酱酽酾酿释里鉅鉴銮錾钆钇针钉钊钋钌钍钎钏钐钑钒钓钔钕钖钗钘钙钚钛钝钞") + "钟钠钡钢钣钤钥钦钧钨钩钪钫钬钭钮钯钰钱钲钳钴钵钶钷钸钹钺钻钼钽钾钿铀铁铂铃铄铅铆铈铉铊铋铍铎铏铐铑铒铕铗铘铙" + "铚铛铜铝铞铟铠铡铢铣铤铥铦铧铨铪铫铬铭铮铯铰铱铲铳铴铵银铷铸铹铺铻铼铽链铿销锁锂锃锄锅锆锇锈锉锊锋锌锍锎锏锐") + "锑锒锓锔锕锖锗错锚锜锞锟锠锡锢锣锤锥锦锨锩锫锬锭键锯锰锱锲锳锴锵锶锷锸锹锺锻锼锽锾锿镀镁镂镃镆镇镈镉镊镌镍镎" + "镏镐镑镒镕镖镗镙镚镛镜镝镞镟镠镡镢镣镤镥镦镧镨镩镪镫镬镭镮镯镰镱镲镳镴镶长门闩闪闫闬闭问闯闰闱闲闳间闵闶闷闸") + "闹闺闻闼闽闾闿阀阁阂阃阄阅阆阇阈阉阊阋阌阍阎阏阐阑阒阓阔阕阖阗阘阙阚阛队阳阴阵阶际陆陇陈陉陕陧陨险随隐隶隽难" + "雏雠雳雾霁霉霭靓静靥鞑鞒鞯鞴韦韧韨韩韪韫韬韵页顶顷顸项顺须顼顽顾顿颀颁颂颃预颅领颇颈颉颊颋颌颍颎颏颐频颒颓颔") + "颕颖颗题颙颚颛颜额颞颟颠颡颢颣颤颥颦颧风飏飐飑飒飓飔飕飖飗飘飙飚飞飨餍饤饥饦饧饨饩饪饫饬饭饮饯饰饱饲饳饴饵饶" + "饷饸饹饺饻饼饽饾饿馀馁馂馃馄馅馆馇馈馉馊馋馌馍馎馏馐馑馒馓馔馕马驭驮驯驰驱驲驳驴驵驶驷驸驹驺驻驼驽驾驿骀骁骂") + "骃骄骅骆骇骈骉骊骋验骍骎骏骐骑骒骓骔骕骖骗骘骙骚骛骜骝骞骟骠骡骢骣骤骥骦骧髅髋髌鬓魇魉鱼鱽鱾鱿鲀鲁鲂鲄鲅鲆鲇" + "鲈鲉鲊鲋鲌鲍鲎鲏鲐鲑鲒鲓鲔鲕鲖鲗鲘鲙鲚鲛鲜鲝鲞鲟鲠鲡鲢鲣鲤鲥鲦鲧鲨鲩鲪鲫鲬鲭鲮鲯鲰鲱鲲鲳鲴鲵鲶鲷鲸鲹鲺鲻鲼鲽") + "鲾鲿鳀鳁鳂鳃鳄鳅鳆鳇鳈鳉鳊鳋鳌鳍鳎鳏鳐鳑鳒鳓鳔鳕鳖鳗鳘鳙鳛鳜鳝鳞鳟鳠鳡鳢鳣鸟鸠鸡鸢鸣鸤鸥鸦鸧鸨鸩鸪鸫鸬鸭鸮鸯" + "鸰鸱鸲鸳鸴鸵鸶鸷鸸鸹鸺鸻鸼鸽鸾鸿鹀鹁鹂鹃鹄鹅鹆鹇鹈鹉鹊鹋鹌鹍鹎鹏鹐鹑鹒鹓鹔鹕鹖鹗鹘鹚鹛鹜鹝鹞鹟鹠鹡鹢鹣鹤鹥鹦") + "鹧鹨鹩鹪鹫鹬鹭鹯鹰鹱鹲鹳鹴鹾麦麸黄黉黡黩黪黾鼋鼌鼍鼗鼹齄齐齑齿龀龁龂龃龄龅龆龇龈龉龊龋龌龙龚龛龟志制咨只里系" + "范松没尝尝闹面准钟别闲干尽脏拼";
            str2 = "萬與醜專業叢東絲丟兩嚴喪個爿豐臨為麗舉麼義烏樂喬習鄉書買亂爭於虧雲亙亞產畝親褻嚲億僅從侖倉儀們價眾優夥會傴傘";
            str2 = (((((((((((((((((((((((str2 + "偉傳傷倀倫傖偽佇體餘傭僉俠侶僥偵側僑儈儕儂俁儔儼倆儷儉債傾傯僂僨償儻儐儲儺兒兌兗黨蘭關興茲養獸囅內岡冊寫軍農") + "塚馮衝決況凍淨淒涼淩減湊凜幾鳳鳧憑凱擊氹鑿芻劃劉則剛創刪別剗剄劊劌剴劑剮劍剝劇勸辦務勱動勵勁勞勢勳猛勩勻匭匱" + "區醫華協單賣盧鹵臥衛卻巹廠廳曆厲壓厭厙廁廂厴廈廚廄廝縣參靉靆雙發變敘疊葉號歎嘰籲後嚇呂嗎唚噸聽啟吳嘸囈嘔嚦唄") + "員咼嗆嗚詠哢嚨嚀噝吒噅鹹呱響啞噠嘵嗶噦嘩噲嚌噥喲嘜嗊嘮啢嗩唕喚呼嘖嗇囀齧囉嘽嘯噴嘍嚳囁嗬噯噓嚶囑嚕劈囂謔團園" + "囪圍圇國圖圓聖壙場阪壞塊堅壇壢壩塢墳墜壟壟壚壘墾坰堊墊埡墶壋塏堖塒塤堝墊垵塹墮壪牆壯聲殼壺壼處備複夠頭誇夾奪") + "奩奐奮獎奧妝婦媽嫵嫗媯姍薑婁婭嬈嬌孌娛媧嫻嫿嬰嬋嬸媼嬡嬪嬙嬤孫學孿寧寶實寵審憲宮寬賓寢對尋導壽將爾塵堯尷屍盡" + "層屭屜屆屬屢屨嶼歲豈嶇崗峴嶴嵐島嶺嶽崠巋嶨嶧峽嶢嶠崢巒嶗崍嶮嶄嶸嶔崳嶁脊巔鞏巰幣帥師幃帳簾幟帶幀幫幬幘幗冪襆") + "幹並廣莊慶廬廡庫應廟龐廢廎廩開異棄張彌弳彎彈強歸當錄彠彥徹徑徠禦憶懺憂愾懷態慫憮慪悵愴憐總懟懌戀懇惡慟懨愷惻" + "惱惲悅愨懸慳憫驚懼慘懲憊愜慚憚慣湣慍憤憒願懾憖怵懣懶懍戇戔戲戧戰戩戶紮撲扡執擴捫掃揚擾撫拋摶摳掄搶護報擔擬攏") + "揀擁攔擰撥擇掛摯攣掗撾撻挾撓擋撟掙擠揮撏撈損撿換搗據撚擄摑擲撣摻摜摣攬撳攙擱摟攪攜攝攄擺搖擯攤攖撐攆擷擼攛擻" + "攢敵斂數齋斕鬥斬斷無舊時曠暘曇晝曨顯晉曬曉曄暈暉暫曖劄術樸機殺雜權條來楊榪傑極構樅樞棗櫪梘棖槍楓梟櫃檸檉梔柵") + "標棧櫛櫳棟櫨櫟欄樹棲樣欒棬椏橈楨檔榿橋樺檜槳樁夢檮棶檢欞槨櫝槧欏橢樓欖櫬櫚櫸檟檻檳櫧橫檣櫻櫫櫥櫓櫞簷檁歡歟歐" + "殲歿殤殘殞殮殫殯毆毀轂畢斃氈毿氌氣氫氬氳彙漢汙湯洶遝溝沒灃漚瀝淪滄渢溈滬濔濘淚澩瀧瀘濼瀉潑澤涇潔灑窪浹淺漿澆") + "湞溮濁測澮濟瀏滻渾滸濃潯濜塗湧濤澇淶漣潿渦溳渙滌潤澗漲澀澱淵淥漬瀆漸澠漁瀋滲溫遊灣濕潰濺漵漊潷滾滯灩灄滿瀅濾" + "濫灤濱灘澦濫瀠瀟瀲濰潛瀦瀾瀨瀕灝滅燈靈災燦煬爐燉煒熗點煉熾爍爛烴燭煙煩燒燁燴燙燼熱煥燜燾煆糊溜愛爺牘犛牽犧犢") + "強狀獷獁猶狽麅獮獰獨狹獅獪猙獄猻獫獵獼玀豬貓蝟獻獺璣璵瑒瑪瑋環現瑲璽瑉玨琺瓏璫琿璡璉瑣瓊瑤璦璿瓔瓚甕甌電畫暢" + "佘疇癤療瘧癘瘍鬁瘡瘋皰屙癰痙癢瘂癆瘓癇癡癉瘮瘞瘺癟癱癮癭癩癬癲臒皚皺皸盞鹽監蓋盜盤瞘眥矓著睜睞瞼瞞矚矯磯礬礦") + "碭碼磚硨硯碸礪礱礫礎硜矽碩硤磽磑礄確鹼礙磧磣堿镟滾禮禕禰禎禱禍稟祿禪離禿稈種積稱穢穠穭稅穌穩穡窮竊竅窯竄窩窺" + "竇窶豎競篤筍筆筧箋籠籩築篳篩簹箏籌簽簡籙簀篋籜籮簞簫簣簍籃籬籪籟糴類秈糶糲粵糞糧糝餱緊縶糸糾紆紅紂纖紇約級紈") + "纊紀紉緯紜紘純紕紗綱納紝縱綸紛紙紋紡紵紖紐紓線紺絏紱練組紳細織終縐絆紼絀紹繹經紿綁絨結絝繞絰絎繪給絢絳絡絕絞" + "統綆綃絹繡綌綏絛繼綈績緒綾緓續綺緋綽緔緄繩維綿綬繃綢綯綹綣綜綻綰綠綴緇緙緗緘緬纜緹緲緝縕繢緦綞緞緶線緱縋緩締") + "縷編緡緣縉縛縟縝縫縗縞纏縭縊縑繽縹縵縲纓縮繆繅纈繚繕繒韁繾繰繯繳纘罌網羅罰罷羆羈羥羨翹翽翬耮耬聳恥聶聾職聹聯" + "聵聰肅腸膚膁腎腫脹脅膽勝朧腖臚脛膠脈膾髒臍腦膿臠腳脫腡臉臘醃膕齶膩靦膃騰臏臢輿艤艦艙艫艱豔艸藝節羋薌蕪蘆蓯葦") + "藶莧萇蒼苧蘇檾蘋莖蘢蔦塋煢繭荊薦薘莢蕘蓽蕎薈薺蕩榮葷滎犖熒蕁藎蓀蔭蕒葒葤藥蒞蓧萊蓮蒔萵薟獲蕕瑩鶯蓴蘀蘿螢營縈" + "蕭薩蔥蕆蕢蔣蔞藍薊蘺蕷鎣驀薔蘞藺藹蘄蘊藪槁蘚虜慮虛蟲虯蟣雖蝦蠆蝕蟻螞蠶蠔蜆蠱蠣蟶蠻蟄蛺蟯螄蠐蛻蝸蠟蠅蟈蟬蠍螻") + "蠑螿蟎蠨釁銜補襯袞襖嫋褘襪襲襏裝襠褌褳襝褲襇褸襤繈襴見觀覎規覓視覘覽覺覬覡覿覥覦覯覲覷觴觸觶讋譽謄訁計訂訃認" + "譏訐訌討讓訕訖訓議訊記訒講諱謳詎訝訥許訛論訩訟諷設訪訣證詁訶評詛識詗詐訴診詆謅詞詘詔詖譯詒誆誄試詿詩詰詼誠誅") + "詵話誕詬詮詭詢詣諍該詳詫諢詡譸誡誣語誚誤誥誘誨誑說誦誒請諸諏諾讀諑誹課諉諛誰諗調諂諒諄誶談誼謀諶諜謊諫諧謔謁" + "謂諤諭諼讒諮諳諺諦謎諞諝謨讜謖謝謠謗諡謙謐謹謾謫譾謬譚譖譙讕譜譎讞譴譫讖穀豶貝貞負貟貢財責賢敗賬貨質販貪貧貶") + "購貯貫貳賤賁貰貼貴貺貸貿費賀貽賊贄賈賄貲賃賂贓資賅贐賕賑賚賒賦賭齎贖賞賜贔賙賡賠賧賴賵贅賻賺賽賾贗讚贇贈贍贏" + "贛赬趙趕趨趲躉躍蹌蹠躒踐躂蹺蹕躚躋踴躊蹤躓躑躡蹣躕躥躪躦軀車軋軌軒軑軔轉軛輪軟轟軲軻轤軸軹軼軤軫轢軺輕軾載輊") + "轎輈輇輅較輒輔輛輦輩輝輥輞輬輟輜輳輻輯轀輸轡轅轄輾轆轍轔辭辯辮邊遼達遷過邁運還這進遠違連遲邇逕跡適選遜遞邐邏" + "遺遙鄧鄺鄔郵鄒鄴鄰鬱郤郟鄶鄭鄆酈鄖鄲醞醱醬釅釃釀釋裏钜鑒鑾鏨釓釔針釘釗釙釕釷釺釧釤鈒釩釣鍆釹鍚釵鈃鈣鈈鈦鈍鈔") + "鍾鈉鋇鋼鈑鈐鑰欽鈞鎢鉤鈧鈁鈥鈄鈕鈀鈺錢鉦鉗鈷缽鈳鉕鈽鈸鉞鑽鉬鉭鉀鈿鈾鐵鉑鈴鑠鉛鉚鈰鉉鉈鉍鈹鐸鉶銬銠鉺銪鋏鋣鐃" + "銍鐺銅鋁銱銦鎧鍘銖銑鋌銩銛鏵銓鉿銚鉻銘錚銫鉸銥鏟銃鐋銨銀銣鑄鐒鋪鋙錸鋱鏈鏗銷鎖鋰鋥鋤鍋鋯鋨鏽銼鋝鋒鋅鋶鐦鐧銳") + "銻鋃鋟鋦錒錆鍺錯錨錡錁錕錩錫錮鑼錘錐錦鍁錈錇錟錠鍵鋸錳錙鍥鍈鍇鏘鍶鍔鍤鍬鍾鍛鎪鍠鍰鎄鍍鎂鏤鎡鏌鎮鎛鎘鑷鐫鎳鎿" + "鎦鎬鎊鎰鎔鏢鏜鏍鏰鏞鏡鏑鏃鏇鏐鐔钁鐐鏷鑥鐓鑭鐠鑹鏹鐙鑊鐳鐶鐲鐮鐿鑔鑣鑞鑲長門閂閃閆閈閉問闖閏闈閑閎間閔閌悶閘") + "鬧閨聞闥閩閭闓閥閣閡閫鬮閱閬闍閾閹閶鬩閿閽閻閼闡闌闃闠闊闋闔闐闒闕闞闤隊陽陰陣階際陸隴陳陘陝隉隕險隨隱隸雋難" + "雛讎靂霧霽黴靄靚靜靨韃鞽韉韝韋韌韍韓韙韞韜韻頁頂頃頇項順須頊頑顧頓頎頒頌頏預顱領頗頸頡頰頲頜潁熲頦頤頻頮頹頷") + "頴穎顆題顒顎顓顏額顳顢顛顙顥纇顫顬顰顴風颺颭颮颯颶颸颼颻飀飄飆飆飛饗饜飣饑飥餳飩餼飪飫飭飯飲餞飾飽飼飿飴餌饒" + "餉餄餎餃餏餅餑餖餓餘餒餕餜餛餡館餷饋餶餿饞饁饃餺餾饈饉饅饊饌饢馬馭馱馴馳驅馹駁驢駔駛駟駙駒騶駐駝駑駕驛駘驍罵") + "駰驕驊駱駭駢驫驪騁驗騂駸駿騏騎騍騅騌驌驂騙騭騤騷騖驁騮騫騸驃騾驄驏驟驥驦驤髏髖髕鬢魘魎魚魛魢魷魨魯魴魺鮁鮃鯰" + "鱸鮋鮓鮒鮊鮑鱟鮍鮐鮭鮚鮳鮪鮞鮦鰂鮜鱠鱭鮫鮮鮺鯗鱘鯁鱺鰱鰹鯉鰣鰷鯀鯊鯇鮶鯽鯒鯖鯪鯕鯫鯡鯤鯧鯝鯢鯰鯛鯨鯵鯴鯔鱝鰈") + "鰏鱨鯷鰮鰃鰓鱷鰍鰒鰉鰁鱂鯿鰠鼇鰭鰨鰥鰩鰟鰜鰳鰾鱈鱉鰻鰵鱅鰼鱖鱔鱗鱒鱯鱤鱧鱣鳥鳩雞鳶鳴鳲鷗鴉鶬鴇鴆鴣鶇鸕鴨鴞鴦" + "鴒鴟鴝鴛鴬鴕鷥鷙鴯鴰鵂鴴鵃鴿鸞鴻鵐鵓鸝鵑鵠鵝鵒鷳鵜鵡鵲鶓鵪鶤鵯鵬鵮鶉鶊鵷鷫鶘鶡鶚鶻鶿鶥鶩鷊鷂鶲鶹鶺鷁鶼鶴鷖鸚") + "鷓鷚鷯鷦鷲鷸鷺鸇鷹鸌鸏鸛鸘鹺麥麩黃黌黶黷黲黽黿鼂鼉鞀鼴齇齊齏齒齔齕齗齟齡齙齠齜齦齬齪齲齷龍龔龕龜誌製谘隻裡係" + "範鬆冇嚐嘗鬨麵準鐘彆閒乾儘臟拚";
            for (int i = 0; i < strInfo.Length; i++)
            {
                str4 = strInfo.Substring(i, 1);
                startIndex = str.IndexOf(str4);
                if (startIndex >= 0)
                {
                    str3 = str3 + str2.Substring(startIndex, 1);
                }
                else
                {
                    str3 = str3 + str4;
                }
            }
            return str3;
        }

        public int ExecuteSql(string strSql)
        {
            int num = 0;
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(strSql, connection);
            num = command.ExecuteNonQuery();
            connection.Close();
            command.Dispose();
            connection.Dispose();
            return num;
        }

        public void GetFolderInfo(DropDownList DDLTmp, string strSql, string strIsAll, string strUserCode, string strMyDeptID)
        {
            DDLTmp.Items.Clear();
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            SqlCommand command = new SqlCommand(strSql, connection);
            connection.Open();
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                ListItem item = new ListItem(reader["FolderName"].ToString(), reader["ID"].ToString());
                DDLTmp.Items.Add(item);
                this.method_2(DDLTmp, Convert.ToInt32(reader["ID"].ToString()), 1, strIsAll, strUserCode, strMyDeptID);
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        public void GetItem(DropDownList DDLTmp, int intSubjectID)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
            string cmdText = "Select ID,ItemName From BookItem Where UPID=0 and SubjectID=" + intSubjectID + " order by SortInfo,ID";
            SqlConnection connection = new SqlConnection(connectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                ListItem item = new ListItem(reader["ItemName"].ToString(), reader["ID"].ToString());
                DDLTmp.Items.Add(item);
                this.method_5(DDLTmp, Convert.ToInt32(reader["ID"].ToString()), intSubjectID, 1);
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        public string GetManagDeptID(string strDeptID)
        {
            string str = " b.ID=" + strDeptID;
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("Select b.ID From DeptInfo b Where b.UPID = " + strDeptID + " order by b.UPID,b.SortInfo", connection);
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                str = str + " or " + this.GetManagDeptID(reader["ID"].ToString());
            }
            connection.Dispose();
            command.Dispose();
            connection.Close();
            reader.Close();
            return str;
        }

        public string GetManagSubjectID(string strSubjectID)
        {
            string str = " b.ID=" + strSubjectID;
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("Select b.ID From SubjectInfo b Where b.UPID = " + strSubjectID + " order by b.UPID,b.SortInfo", connection);
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                str = str + " or " + this.GetManagDeptID(reader["ID"].ToString());
            }
            connection.Dispose();
            command.Dispose();
            connection.Close();
            reader.Close();
            return str;
        }

        public string GetRubricType(string strType, string strPaperID)
        {
            string cmdText = "";
            string str3 = "";
            if (strPaperID == "0")
            {
                cmdText = "select ParmName from SysParmInfo where ParmValue='" + strType + "' and ParmMemo='RubricType'";
            }
            else
            {
                cmdText = "select RubricTypeName as ParmName from PaperInfo where ID='" + strPaperID + "'";
            }
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                str3 = reader["ParmName"].ToString();
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
            if (!(strPaperID == "0"))
            {
                string[] strArray = str3.Split(new char[] { '#' });
                switch (strType)
                {
                    case "A":
                        return strArray[0].Trim();

                    case "B":
                        return strArray[1].Trim();

                    case "C":
                        return strArray[2].Trim();

                    case "D":
                        return strArray[3].Trim();

                    case "E":
                        return strArray[4].Trim();

                    case "F":
                        return strArray[5].Trim();

                    case "G":
                        return strArray[6].Trim();

                    case "H":
                        return strArray[7].Trim();

                    case "I":
                        return strArray[8].Trim();

                    case "J":
                        return strArray[9].Trim();
                }
                return str3;
            }
            if (str3.Trim() == "")
            {
                switch (strType)
                {
                    case "A":
                        return "单选题";

                    case "B":
                        return "多选题";

                    case "C":
                        return "判断题";

                    case "D":
                        return "填空题";

                    case "E":
                        return "简答题";

                    case "F":
                        return "作文题";

                    case "G":
                        return "论述题";

                    case "H":
                        return "分析题";

                    case "I":
                        return "操作题";

                    case "J":
                        return "综合题";
                }
            }
            return str3;
        }

        public int GetSqlID(string strSql)
        {
            int num = 0;
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("SET NOCOUNT ON;" + strSql + ";SELECT @@IDENTITY", connection);
            SqlDataReader reader = command.ExecuteReader();
            if (reader.Read())
            {
                num = Convert.ToInt32(reader[0].ToString());
            }
            command.Dispose();
            reader.Close();
            connection.Close();
            connection.Dispose();
            return num;
        }

        public void GetType(DropDownList DDLTmp, string strFlag, string strUserCode, string Right, string strMyDeptID)
        {
            DDLTmp.Items.Clear();
            string connectionString = ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
            string cmdText = "Select ID,TypeName From TypeList Where  Flag='" + strFlag + "' ";
            SqlConnection connection = new SqlConnection(connectionString);
            connection.Open();
            string str3 = Right;
            if (str3 != null)
            {
                if (str3 == "Y")
                {
                    cmdText = "Select ID,TypeName From TypeList Where  Flag='" + strFlag + "' and UpID=0 order by ID ";
                }
                else if (!(str3 == "B"))
                {
                    if (str3 == "N")
                    {
                        cmdText = "Select ID,TypeName From TypeList Where  Flag='" + strFlag + "' and UpID=0 and(InputUser='" + strUserCode + "' or EditUserCode like  '%," + strUserCode + ",%' or  EditUserCode like'%,所有人员,%'  or BrowDeptID like '%," + strMyDeptID + ",%' or BrowDeptName like '%,所有部门,%' ) order by ID ";
                    }
                }
                else
                {
                    cmdText = "Select ID,TypeName From TypeList Where  Flag='" + strFlag + "' and UpID=0 and (InputUser='" + strUserCode + "' or BrowUserCode like '%," + strUserCode + ",%' or BrowUserCode like '%,所有人员,%'  or BrowDeptID like '%," + strMyDeptID + ",%' or BrowDeptName like '%,所有部门,%' ) order by ID";
                }
            }
            SqlCommand command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                ListItem item = new ListItem(reader["TypeName"].ToString(), reader["ID"].ToString());
                DDLTmp.Items.Add(item);
                this.method_4(DDLTmp, Convert.ToInt32(reader["ID"].ToString()), strFlag, strUserCode, Right, 1, strMyDeptID);
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        public string GetValues(string strSql)
        {
            string str2 = "";
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(strSql, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                str2 = str2 + reader[0].ToString() + ",";
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
            return str2;
        }

        public string GetValues(string strSql, string strFiled)
        {
            string str2 = "";
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(strSql, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                str2 = Convert.ToString(reader[strFiled.Trim()]);
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
            return str2.Trim();
        }

        public string HtmlToText(string strHtmlToText)
        {
            string input = strHtmlToText;
            string pattern = "<img/g";
            input = new Regex(pattern).Replace(input, "♂");
            pattern = "(♂[^>]*)>/g";
            input = new Regex(pattern).Replace(input, "$1♀");
            pattern = "<.+?>";
            input = new Regex(pattern).Replace(input, "");
            pattern = "♂/g";
            input = new Regex(pattern).Replace(input, "<img");
            pattern = "♀/g";
            Regex regex = new Regex(pattern);
            return regex.Replace(input, ">");
        }

        public void LoadDeptInfo(DropDownList DDLTmp, string strDeptID, string strUserCode, string strUserLevel)
        {
            DDLTmp.Items.Clear();
            string cmdText = "";
            if (strUserLevel == "C")
            {
                cmdText = "select ID,DeptName from DeptInfo Where UpID=0 order by SortInfo,ID";
            }
            else
            {
                cmdText = "select ID,DeptName from DeptInfo Where ID=" + strDeptID + "  order by SortInfo,ID";
            }
            string connectionString = ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
            SqlConnection connection = new SqlConnection(connectionString);
            SqlConnection connection2 = new SqlConnection(connectionString);
            SqlCommand command = new SqlCommand(cmdText, connection);
            connection.Open();
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                ListItem item = new ListItem(reader["DeptName"].ToString(), reader["ID"].ToString());
                DDLTmp.Items.Add(item);
                this.method_1(DDLTmp, reader["ID"].ToString(), 1);
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
            connection2.Close();
            connection2.Dispose();
            DDLTmp.SelectedIndex = -1;
        }

        public void LoadSubjectInfo(DropDownList DDLTmp, string strUserCode, string strPower, string strFlag, string strMyDeptID)
        {
            DDLTmp.Items.Clear();
            string cmdText = "";
            if (strPower == "Y")
            {
                cmdText = "select ID,SubjectName from SubjectInfo Where UpID=0 order by SortInfo,ID";
            }
            else if (!(strFlag == "B"))
            {
                cmdText = "select ID,SubjectName from SubjectInfo Where  UpID=0 and (EditUserCode like '%," + strUserCode + ",%' or CreatUserName='" + strUserCode + "')  order by UPID,SortInfo,ID";
            }
            else
            {
                cmdText = "select ID,SubjectName from SubjectInfo Where  UpID=0 and (EditUserCode like '%," + strUserCode + ",%' or (BrowUserCode like '%," + strUserCode + ",%' or BrowUserCode like '%,所有人员,%'   or BrowDeptID like '%," + strMyDeptID + ",%' or BrowDeptName like '%,所有部门,%' ))  order by UPID,SortInfo,ID";
            }
            string connectionString = ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
            SqlConnection connection = new SqlConnection(connectionString);
            SqlConnection connection2 = new SqlConnection(connectionString);
            SqlCommand command = new SqlCommand(cmdText, connection);
            connection.Open();
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                ListItem item = new ListItem(reader["SubjectName"].ToString(), reader["ID"].ToString());
                DDLTmp.Items.Add(item);
                this.method_0(DDLTmp, reader["ID"].ToString(), 1, strPower, strUserCode, strFlag, strMyDeptID);
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
            connection2.Close();
            connection2.Dispose();
            DDLTmp.SelectedIndex = -1;
        }

        private void method_0(DropDownList dropDownList_0, string string_0, int int_0, string string_1, string string_2, string string_3, string string_4)
        {
            string str2;
            string str = "";
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            if (string_1 != "Y")
            {
                if (string_3 == "B")
                {
                    str2 = "Select ID,SubjectName from SubjectInfo Where UPID = " + string_0 + "  and  (EditUserCode like '%," + string_2 + ",%' or (BrowUserCode like '%," + string_2 + ",%' or BrowUserCode like '%,所有人员,%'   or BrowDeptID like '%," + string_4 + ",%' or BrowDeptName like '%,所有部门,%' ))  order by UPID,SortInfo,ID";
                }
                else
                {
                    str2 = "select ID,SubjectName from SubjectInfo Where UPID = " + string_0 + "  and  (EditUserCode like '%," + string_2 + ",%' or CreatUserName='" + string_2 + "')  order by UPID,SortInfo,ID";
                }
            }
            else
            {
                str2 = "Select ID,SubjectName from SubjectInfo Where UPID = " + string_0 + " order by UPID,SortInfo,ID";
            }
            SqlCommand command = new SqlCommand(str2, connection);
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                for (int i = 0; i < int_0; i++)
                {
                    if (i >= (int_0 - 1))
                    {
                        str = str + "├";
                    }
                    else
                    {
                        str = str + "│";
                    }
                }
                ListItem item = new ListItem((str + reader["SubjectName"].ToString()).Trim(), reader["ID"].ToString());
                dropDownList_0.Items.Add(item);
                str = "";
                this.method_0(dropDownList_0, reader["ID"].ToString(), int_0 + 1, string_1, string_2, string_3, string_4);
            }
            connection.Dispose();
            command.Dispose();
            connection.Close();
            reader.Close();
        }

        private void method_1(DropDownList dropDownList_0, string string_0, int int_0)
        {
            string str = "";
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("Select ID,DeptName From DeptInfo Where UPID = " + string_0 + " order by UPID,SortInfo", connection);
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                for (int i = 0; i < int_0; i++)
                {
                    if (i >= (int_0 - 1))
                    {
                        str = str + "├";
                    }
                    else
                    {
                        str = str + "│";
                    }
                }
                ListItem item = new ListItem((str + reader["DeptName"].ToString()).Trim(), reader["ID"].ToString());
                dropDownList_0.Items.Add(item);
                str = "";
                this.method_1(dropDownList_0, reader["ID"].ToString(), int_0 + 1);
            }
            connection.Dispose();
            command.Dispose();
            connection.Close();
            reader.Close();
        }

        private void method_2(DropDownList dropDownList_0, int int_0, int int_1, string string_0, string string_1, string string_2)
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            string cmdText = "";
            if (string_0 != "0")
            {
                if (!(string_0 == "1"))
                {
                    cmdText = string.Concat(new object[] { "select ID,FolderName from GradeFolder where UPID=", int_0, " and  ( EditUserCode like '%,", string_1, ",%' or BrowUserCode like '%,所有人员,%' or BrowUserCode like '%,", string_1, ",%'  or BrowDeptID like '%,", string_2, ",%' or BrowDeptName like '%,所有部门,%' ) order by SortInfo, ID " });
                }
                else
                {
                    cmdText = string.Concat(new object[] { "select ID,FolderName from GradeFolder where UPID=", int_0, " and  EditUserCode like '%,", string_1, ",%' order by SortInfo, ID " });
                }
            }
            else
            {
                cmdText = "select ID,FolderName from GradeFolder where UPID=" + int_0 + " order by SortInfo, ID ";
            }
            SqlCommand command = new SqlCommand(cmdText, connection);
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                string str3 = "";
                for (int i = 0; i < int_1; i++)
                {
                    if (i < (int_1 - 1))
                    {
                        str3 = str3 + "│";
                    }
                    else
                    {
                        str3 = str3 + "├";
                    }
                }
                ListItem item = new ListItem(str3 + reader["FolderName"].ToString(), reader["ID"].ToString());
                dropDownList_0.Items.Add(item);
                str3 = "";
                this.method_2(dropDownList_0, Convert.ToInt32(reader["ID"].ToString()), int_1 + 1, string_0, string_1, string_2);
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        private string method_3(int int_0)
        {
            string str = "";
            if (int_0 > 0)
            {
                for (int i = 0; i < int_0; i++)
                {
                    str = str + "│";
                }
            }
            return str;
        }

        private void method_4(DropDownList dropDownList_0, int int_0, string string_0, string string_1, string string_2, int int_1, string string_3)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
            string cmdText = string.Concat(new object[] { "Select ID,TypeName From TypeList Where  Flag='", string_0, "' and UPID=", int_0 });
            SqlConnection connection = new SqlConnection(connectionString);
            connection.Open();
            switch (string_2)
            {
                case "Y":
                    cmdText = string.Concat(new object[] { "select ID,TypeName from TypeList where Flag='", string_0, "' and UPID=", int_0, "  order by ID " });
                    break;

                case "B":
                    cmdText = string.Concat(new object[] { "Select ID,TypeName From TypeList Where  Flag='", string_0, "' and UPID=", int_0, " and (InputUser='", string_1, "' or BrowUserCode like '%,", string_1, ",%' or BrowUserCode like '%,所有人员,%'  or BrowDeptID like '%,", string_3, ",%' or BrowDeptName like '%,所有部门,%' ) order by ID" });
                    break;

                case "N":
                    cmdText = string.Concat(new object[] { "select ID,TypeName from TypeList where Flag='", string_0, "' and UPID=", int_0, " and(InputUser='", string_1, "' or EditUserCode like  '%,", string_1, ",%'  or EditUserCode like'%,所有人员,%'  or BrowDeptID like '%,", string_3, ",%' or BrowDeptName like '%,所有部门,%' ) order by ID " });
                    break;
            }
            SqlCommand command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                string str4 = "";
                for (int i = 0; i < int_1; i++)
                {
                    if (i < (int_1 - 1))
                    {
                        str4 = str4 + "│";
                    }
                    else
                    {
                        str4 = str4 + "├";
                    }
                }
                ListItem item = new ListItem((str4 + reader["TypeName"].ToString()).Trim(), reader["ID"].ToString());
                dropDownList_0.Items.Add(item);
                str4 = "";
                this.method_4(dropDownList_0, Convert.ToInt32(reader["ID"].ToString()), string_0, string_1, string_2, int_1 + 1, string_3);
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        private void method_5(DropDownList dropDownList_0, int int_0, int int_1, int int_2)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
            string cmdText = string.Concat(new object[] { "Select ID,ItemName From BookItem Where UPID=", int_0, " and SubjectID=", int_1, " order by SortInfo,ID" });
            SqlConnection connection = new SqlConnection(connectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                string str3 = "";
                for (int i = 0; i < int_2; i++)
                {
                    if (i < (int_2 - 1))
                    {
                        str3 = str3 + "│";
                    }
                    else
                    {
                        str3 = str3 + "├";
                    }
                }
                ListItem item = new ListItem((str3 + reader["ItemName"].ToString()).Trim(), reader["ID"].ToString());
                dropDownList_0.Items.Add(item);
                str3 = "";
                this.method_5(dropDownList_0, Convert.ToInt32(reader["ID"].ToString()), int_1, int_2 + 1);
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        public bool OpertionMemberFen(string strUserCode, int intFen)
        {
            bool flag = false;
            string cmdText = "select b.LevelRemove,b.RemoveValue,a.UserFen,a.UpdateTime from UserInfo a,MemberLevel b where a.UserMember=b.ID and a.UserCode='" + strUserCode + "'";
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                switch (reader["LevelRemove"].ToString())
                {
                    case "B":
                        if (Convert.ToInt32(reader["UserFen"].ToString()) < Convert.ToInt32(reader["RemoveValue"].ToString()))
                        {
                            flag = false;
                        }
                        else
                        {
                            this.ExecuteSql(string.Concat(new object[] { "update UserInfo set UserFen=UserFen-", Convert.ToInt32(reader["RemoveValue"].ToString()), " where UserCode='", strUserCode, "'" }));
                            flag = true;
                        }
                        goto Label_024A;

                    case "C":
                        {
                            double num = 0.0;
                            if (!(reader["RemoveValue"].ToString() == ""))
                            {
                                num = Convert.ToDouble(reader["RemoveValue"].ToString());
                            }
                            else
                            {
                                num = 0.0;
                            }
                            if (DateTime.Now <= Convert.ToDateTime(reader["UpdateTime"].ToString()).AddDays(num))
                            {
                                flag = true;
                            }
                            else
                            {
                                this.ExecuteSql("update UserInfo set UserFen=0 where UserCode='" + strUserCode + "'");
                                flag = false;
                            }
                            goto Label_024A;
                        }
                    case "D":
                        if (Convert.ToInt32(reader["UserFen"].ToString()) < intFen)
                        {
                            flag = false;
                        }
                        else
                        {
                            this.ExecuteSql(string.Concat(new object[] { "update UserInfo set UserFen=UserFen-", intFen, " where UserCode='", strUserCode, "'" }));
                            flag = true;
                        }
                        goto Label_024A;
                }
                flag = true;
            }
            Label_024A:
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
            return flag;
        }

        public string RemoveHTML(string strHTML)
        {
            Regex regex = new Regex("<.+?>");
            return regex.Replace(strHTML, "");
        }

        public DataView RetrunDataView(string strSql)
        {
            SqlConnection selectConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            SqlDataAdapter adapter = new SqlDataAdapter(strSql, selectConnection);
            DataSet dataSet = new DataSet();
            adapter.Fill(dataSet, "DataInfo");
            adapter.Dispose();
            selectConnection.Dispose();
            return dataSet.Tables["DataInfo"].DefaultView;
        }

        public int RetrunExecute(string strSql)
        {
            int num = 0;
            if (strSql.Trim() != "")
            {
                SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
                connection.Open();
                SqlCommand command = new SqlCommand("SET NOCOUNT ON;" + strSql + ";SELECT @@IDENTITY", connection);
                SqlDataReader reader = command.ExecuteReader();
                if (reader.Read())
                {
                    num = Convert.ToInt32(reader[0].ToString());
                }
                reader.Close();
                command.Dispose();
                connection.Close();
                connection.Dispose();
            }
            return num;
        }

        public string ReturnPaperData()
        {
            //string password = "";
            //string connectionString = "";
            //string str3 = "No";
            //string str4 = "1";
            //string str5 = "0";
            //string str6 = "";
            //string str7 = "";
            //connectionString = ConfigurationManager.ConnectionStrings["RegInfo"].ConnectionString;
            //str4 = ConfigurationManager.ConnectionStrings["WriteInfo"].ConnectionString;
            //str5 = ConfigurationManager.ConnectionStrings["OnlineNum"].ConnectionString;
            //str7 = ConfigurationManager.ConnectionStrings["ProTitle"].ConnectionString;
            //try
            //{
            //    int num;
            //    ManagementClass class2 = new ManagementClass("Win32_NetworkAdapterConfiguration");
            //    foreach (ManagementObject obj2 in class2.GetInstances())
            //    {
            //        if ((bool) obj2["IPEnabled"])
            //        {
            //            string[] strArray2 = obj2["MacAddress"].ToString().Split(new char[] { ':' });
            //            num = 0;
            //            while (num < strArray2.Length)
            //            {
            //                password = password + strArray2[num].ToString();
            //                num++;
            //            }
            //            password = password.Replace("A", "101");
            //            password = password.Replace("B", "111");
            //            password = password.Replace("C", "121");
            //            password = password.Replace("D", "131");
            //            password = password.Replace("E", "141");
            //            password = password.Replace("F", "151");
            //        }
            //    }
            //    str6 = FormsAuthentication.HashPasswordForStoringInConfigFile(str4 + str5 + "BanalerWkYiQiangSoft" + str7, "md5") + FormsAuthentication.HashPasswordForStoringInConfigFile(password, "SHA1");
            //    str6 = FormsAuthentication.HashPasswordForStoringInConfigFile(str6 + "BanalSoftCpp", "MD5").Trim();
            //    if (str6.Trim().Length > 0x10)
            //    {
            //        str6 = str6.Substring(str6.Trim().Length - 0x10);
            //    }
            //    else
            //    {
            //        for (num = 0; num < (0x10 - str6.Trim().Length); num++)
            //        {
            //            str6 = str6 + "0";
            //        }
            //    }
            //    str6 = str6.Substring(0, 4) + "-" + str6.Substring(4, 4) + "-" + str6.Substring(8, 4) + "-" + str6.Substring(12, 4);
            //}
            //catch
            //{
            //    str3 = "No";
            //}
            //try
            //{
            //    if (connectionString != str6)
            //    {
            //        str3 = "No";
            //        FTRockey2OBJ rockeyobj = (FTRockey2OBJ) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("CF33FBB6-38B6-4847-BB62-6D79B29A904B")));
            //        if (rockeyobj.RY2Find() <= 0)
            //        {
            //            return "No";
            //        }
            //        rockeyobj.OpenSel = 1;
            //        rockeyobj.UID = 0x49d76ba2;
            //        if (rockeyobj.RY2Open() != 0)
            //        {
            //            return "No";
            //        }
            //        rockeyobj.BlockIndex = 0;
            //        if (rockeyobj.RY2Read() >= 0)
            //        {
            //            if (str5 == rockeyobj.Buffer)
            //            {
            //                str3 = "Yes";
            //            }
            //        }
            //        else
            //        {
            //            str3 = "No";
            //        }
            //        rockeyobj.RY2Close();
            //        return str3;
            //    }
            return "Yes";
            //}
            //catch
            //{
            //    return "No";
            //}
        }

        public void SendHandSet(string strUserCode, string strTip, string strSendUserName, string strSendUserCode)
        {
            string values = this.GetValues("select HandCombNO from UserInfo a where UserCode='" + strUserCode + "'", "HandCombNO");
            string strSql = "";
            if (values.Trim() != "")
            {
                strSql = strSql + "insert into CombSendInfo(GetUserName,GetInfoNumber,GetInfoTxt,SMSType,SendUserName,SendUserCode,Flag) values(";
                strSql = strSql + "'" + strUserCode + "','" + values.Trim() + "','" + strTip + "','1','" + strSendUserName + "','" + strSendUserCode + "','A')";
                this.ExecuteSql(strSql);
            }
        }
    }
}

